// page/mine/pages/tixianDetailed/tixianDetailed.js
var app = getApp();
var that;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    navbar: ['全部', '待审核', '待打款', '已打款', '无效'],
    currentTab: 0,
    userimg: wx.getStorageSync("bizUserInfo").wxHeadimg,
    wxNickNameStr: wx.getStorageSync("bizUserInfo").wxNickNameStr,
    loadingHidden: false,
    kong: true,
    allList: [], //全部
    MoneyList: [], //待打款
    completeList: [], //已打款
    loseList: [], //无效
    waitList: [], //待审核
    page: 1,
    limit: 10
  },
  navbarTap: function(e) {
    that = this
    that.currentTab = e.currentTarget.dataset.idx
    console.log(that.currentTab)
    that.setData({
      currentTab: that.currentTab
    })
  },
  /** 
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    that = this
    wx.request({
      url: app.api.cashWithdrawal() + `?page=${that.data.page}&limit=${that.data.limit}&memberId=${wx.getStorageSync("bizUserInfo").id}`,
      method: "POST",
      data: {},
      success: function(res) {
        if (res.statusCode == 200 && res.errMsg == 'request:ok') {
          if (res.data.code == 1) {
            console.log(res.data.data.waitList)
            if (res.data.data.MoneyList == [] && res.data.data.allList == [] && res.data.data.completeList == [] && res.data.data.loseList == [] && res.data.data.waitList == []) {
              that.setData({
                kong: false,
                loadingHidden: true,
              })
            } else {
              that.setData({
                MoneyList: res.data.data.MoneyList, //待打款
                allList: res.data.data.allList, //全部
                completeList: res.data.data.completeList, //已打款
                loseList: res.data.data.loseList, //无效
                waitList: res.data.data.waitList, //待审核
                loadingHidden: true,
                kong: false,
              })
            }
          } else {
            wx.showToast({
              title: res.data.message,
            })
            that.setData({
              kong: false,
              loadingHidden: true,
            })
          }
        }
      }
    })

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})